package com.masterclient.app.businessmodule.homemodule.bean.shoplist;

import android.text.TextUtils;

import com.eoner.baselibrary.utils.ScreenUtils;
import com.eoner.commonbean.product.ProductMessage;

public class ProductHomeMessage extends ProductMessage {

    private String dailyPriceAppend;
    private String marketPriceAppend;
    private int homeWidth = 0;
    private double ratio = -1.0;

    public double getRatio() {
        if (ratio <= -1.0) {
            if (!TextUtils.isEmpty(getImage_width())){
                ratio = getHomeWidth()/Double.parseDouble(getImage_width());
            } else {
                ratio = 1.0;
            }
        }
        return ratio;
    }

    public int getHomeWidth() {
        if (homeWidth == 0) {
            homeWidth = (int)((ScreenUtils.getScreenWidth() - ScreenUtils.dp2px(41))/2f);
        }
        return homeWidth;
    }

    public String getDailyPriceAppend() {
        if (dailyPriceAppend == null) {
            if (!TextUtils.isEmpty(getDaily_price())){
                dailyPriceAppend = "¥" + getDaily_price();
            }
        }
        return dailyPriceAppend;
    }

    public String getMarketPriceAppend() {
        if (marketPriceAppend == null) {
            if (!TextUtils.isEmpty(getMarket_price())){
                marketPriceAppend = "¥" + getMarket_price();
            }
        }
        return marketPriceAppend;
    }

}
